import {Suspense,useEffect} from 'react'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({
    easing: "ease-in-out",
    speed: 300,
    trickeSpeed: 300,
})

const Loading=()=>{
    useEffect(()=>{
        //开启动画
        NProgress.start()
        return ()=>NProgress.done()
    },[])
}
const LazyLoad=(element)=>{
    return <Suspense fallback={<Loading></Loading>}>
        {element}
    </Suspense>
}
export default LazyLoad